//
//  DSZGoViewController.m
//  7.13苏宁框架
//
//  Created by lovena on 15/7/22.
//  Copyright (c) 2015年 lovena. All rights reserved.
//

#import "DSZGoViewController.h"
#import "DSZMainViewController.h"
@interface DSZGoViewController ()

@end

@implementation DSZGoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //设置滑动
    _scrollView=[[UIScrollView alloc]initWithFrame:self.view.bounds];
    _scrollView.pagingEnabled=YES;
    _scrollView.bounces=NO;
    _scrollView.showsHorizontalScrollIndicator=NO;
    _scrollView.delegate=self;
    [self.view addSubview:_scrollView];
    [self initSubViews];
    [self loadBut];
}

-(void)initSubViews
{
    //图片数组
    NSArray *array=@[@"helper320x480_0",@"helper320x480_1"];
    //加入滑动
    for(int i=0;i<array.count;i++)
    {
        UIImageView *image=[[UIImageView alloc]initWithFrame:CGRectMake(i*320, 0, 320, 480)];
        image.image=[UIImage imageNamed:array[i]];
        [_scrollView addSubview:image];
        
    }
    _scrollView.contentSize=CGSizeMake(array.count*320, 0);
}
//添加按钮
-(void)loadBut
{
    UIButton *firBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    firBtn.frame=CGRectMake(_scrollView.frame.size.width-40, _scrollView.frame.size.height-40, 22, 22);
    firBtn.font=[UIFont systemFontOfSize:9];
    firBtn.layer.cornerRadius=11;
    firBtn.layer.masksToBounds=YES;
    firBtn.layer.borderWidth=1;
    firBtn.layer.borderColor=[UIColor whiteColor].CGColor;
    firBtn.alpha=0.4;
    [firBtn setTitle:@"跳过" forState:UIControlStateNormal];
    [firBtn addTarget:self action:@selector(comeInNext) forControlEvents:UIControlEventTouchUpInside];
    [_scrollView addSubview:firBtn];
    
    UIButton *secBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    [secBtn setTitle:@"开启苏宁之旅" forState:UIControlStateNormal];
    secBtn.frame=CGRectMake(320+(_scrollView.frame.size.width-100)/2,_scrollView.frame.size.height-70, 100, 25);
    secBtn.font=[UIFont systemFontOfSize:13];
    secBtn.layer.cornerRadius=2;
    secBtn.layer.masksToBounds=YES;
    secBtn.layer.borderWidth=1;
    secBtn.layer.borderColor=[UIColor whiteColor].CGColor;
    [_scrollView addSubview:secBtn];
    [secBtn addTarget:self action:@selector(comeInNext) forControlEvents:UIControlEventTouchUpInside];
}
-(void)comeInNext
{
    UIStoryboard *story=[UIStoryboard storyboardWithName:@"Main" bundle:nil];
    DSZMainViewController *vc=[story instantiateViewControllerWithIdentifier:@"main"];
    [self presentViewController:vc animated:NO completion:nil];
}
@end
